﻿using JESAI.Redis.Abstracts.Commands;
using System;
using System.Collections.Generic;
using System.Text;

namespace JESAI.Redis.Commands
{
    internal class RedisCommandArg : IRedisCommandArg
    {
        private RedisCommandArg()
        {

        }

        public RedisCommandArg(string cmd, object[] args, string key = default)
        {
            Cmd = cmd;
            Args = args;
            Key = key;
            Length = ((Args?.Length) ?? 0) + 1;
        }

        /// <summary>
        /// 命令
        /// </summary>
        public string Cmd { get; }

        /// <summary>
        /// 操作的key
        /// </summary>
        public string Key { get; }
        /// <summary>
        /// 参数
        /// </summary>
        public object[] Args { get; }

        /// <summary>
        /// 长度
        /// </summary>
        public int Length { get; }
    }
}
